String addr="";
float[] launchSeed = new float[9];
int FlowerState=0;
boolean forMe;  //is this message meant for me?
boolean callSeqStart=false;
int pI=-1;
int pTypeID=-1;

float oscFloatFetch (OscMessage theOscMessage, int which) {
  float theValue=theOscMessage.get(which).floatValue();
  return theValue;
}

void oscEvent(OscMessage theOscMessage) {
  addr = theOscMessage.addrPattern();
  println("S:Sakura Hears a Message.");
  boolean check=false;
  boolean direct=false;

  // print("S:### received an osc message: "+theOscMessage);
  println("S: addrpattern: "+addr);
  //  println("S: typetag: "+theOscMessage.typetag());
  if (addr.indexOf("XX/")==0&&!androidMode) {
    String msg= theOscMessage.get(0).stringValue();
    HUDMsg(addr, msg);
  } 
  if (addr.indexOf("LC/")==0 || addr.indexOf("DC/")==0) {
    if (addr.indexOf("DC/")==0) direct =true; // get rid of this
    FlowerState=int(theOscMessage.get(0).floatValue());
    boolean forMe = decodeFlowers(bloomI);
    if (forMe) {
      for (int i=0;i<9;i++) {
        launchSeed[i]=theOscMessage.get(i).floatValue();
      }
      alignCherish=false;
      if (direct) {
        println("direct connect");
        mDirectSeed();
      } else {
        if (addr.indexOf("t")==3) {
          check=true;
          print("S:Launch Facet ");
        } else { 
          print("S:Update Facet ");
        }
        println("received");
        mLaunchSeed(check);
      }
    } else {
      println("S:not for me");
    }
  }
  if (addr.indexOf("/")==0) {
    println("S:osc ignored");
  }
}
/* this was supposed to fade to black...
 
 //stop facets;
 if (addr.indexOf("ClearFacets")>-1) {
 facetAct=false;
 clearScreen=36;
 */

void mDirectSeed(){
  StartSeq(true);
}
void mLaunchSeed(boolean fresh) 
{
  facetAct=true;
  updateSeq=!fresh;
  pI=int(launchSeed[1]);
  String pType=facets[pI][0];
  pTypeID=int(facets[pI][1]);
  /*
  if (knownFacet==pI) {
   updateSeq=true;
   }
   */
  if (pType.equals("seq")==true) {
    callSeqStart=true;
    if (!fresh) {
      seqAct=true;
    }
  }
}
